<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@next"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.3.4/gsap.min.js"></script>
  <style>
    .fade-enter-active,
    .fade-leave-active {
      transition: opacity .5s;
    }
    .fade-enter-from,
    .fade-leave-to {
      opacity: 0;
    }
  </style>
</head>
<body>
  <div id="app">
    <transition
      name="fade"
      mode="out-in"
    >
      <button v-if="on" key="on" @click="on = false">on</button>
      <button v-else key="off" @click="on = true">off</button>
    </transition>
  </div>

  <script>
    const app = Vue.createApp({
      setup() {
        const on = Vue.ref(false)
        return { on }
      }
    })

    app.mount('#app')
  </script>
</body>
</html>